#include<stdio.h>
int main()
{
    int reverse(int x);
    int n;
    scanf("%d\n",&n);
    printf("%d\n",reverse(n));
}
int reverse(int x){
    long a=0;
    while(x!=0)
    {
        a=a*10+x%10;
        x=x/10;
    }
    if((int)a!=a)
    {
        return 0;
    }
    return (int)a;
}